﻿using System;
using System.Collections;
using System.Collections.Generic;
using MagistrAPI.Enums;
using MagistrAPI.Integration;
using MagistrAPI.MathModel;
using NUnit.Framework;

namespace TestMagistrAPI
{
    [TestFixture]
    class RK4IntegratorTestFixture
    {
        private RK4Integrator _integrator;

        [SetUp]
        public void Init()
        {
            _integrator = new RK4Integrator();

        }

        [Test]
        public void TestIntegrationMethod()
        {
            double[] y0 = {
                              -3608998.7560643037,
                              2027424.9206698083,
                              4916970.4170327466,
                              -959.5669302239,
                              -400.9768981914,
                              1440.0052077401,
                              0,
                              0,
                              0,
                              0,
                              0.872664626,
                              0
                          };
            Dictionary<Equations, List<double>> rezult = _integrator.Integrate(0, 400, 0.5, 0.5, 0.001, y0);
            Assert.AreEqual(Math.Round(-3652206.6374205514, 5), Math.Round(rezult[Equations.X][619], 5));
        }

        //[Test]
        //public void TestCorrectionMethod1()
        //{
        //    double[] rezult = _integrator.Correct(0.23, 0.3, 0.5, 0.27, 1.34, 2, 30, Math.Pow(10, -10));
        //    Assert.IsNotEmpty((ICollection) rezult);
        //}

        //[Test]
        //public void TestCorrectionMethod2()
        //{
        //    double[] rezult = _integrator.Correct(0.23, 0.3, 0.5, 0.27, 1.34, 2, 30, Math.Pow(10, -10));
        //    Assert.AreEqual(Math.Round(0.2484550467, 5), Math.Round(rezult[3], 5));
        //}

        //[Test]
        //public void TestCorrectionMethod3()
        //{
        //    double[] rezult = _integrator.Correct(0.23, 0.3, 0.5, 0.27, 1.34, 2, 30, Math.Pow(10, -10));
        //    Assert.AreEqual(Math.Round(0.5642307607, 5), Math.Round(rezult[8], 5));
        //}

    }
}
